namespace ghost
{
    /**金币收益获得的动画提示提示*/
    export class GoldTip extends GYSprite
    {
        public static show(count:number):void
        {
            let tip:GoldTip;
            if(GoldTip.pool.length == 0)
                tip = new GoldTip;
            else
                tip = GoldTip.pool.pop();
            tip.show(count);
        }        
        public static pool:GoldTip[]=[];
        public inPool:boolean;
        public lab:Laya.Text;        
        constructor()
        {
            super();
            let s = this;
            s.lab = new Laya.Text;
            s.lab.color = "#fff000";
            s.lab.fontSize = 30;            
            s.lab.text = "0";
            s.lab.stroke = 6;
            s.lab.strokeColor = "#000000";
            s.lab.y = 4;
            s.lab.x = 40;            
            s.addChild(s.lab);
            s.texture = Main.instance.getRes(Conf.scene + "gold.png");
        }
        public show(count:number):void
        {
            let s = this;
            s.lab.text = count + "";            
            let bed:Monster = (<CommonScene>SceneManager.instance.sceneLogic)._curBed;
            s.x = bed.skin.x;
            s.y = bed.skin.y - 100;
            Module.getInstance().roleTopLay.addChild(s);
            s.alpha = 1;
            GYTween.to(s, [
                TweenData.getInstance("y", s.y - 50),
                TweenData.getInstance("alpha", 0)
            ], 1000, 0, s, ()=>{
                s.inPool = true;
                GoldTip.pool.push(s);
            });
        }
    }
}